<link type="text/css" rel="stylesheet" href="{url:#css/ucenter.css}" />
{echo:JS::import('form');}
{echo:JS::import('date');}
{echo:JS::import('dialog?skin=tinysimple');}
{echo:JS::import('dialogtools');}

<script type="text/javascript" charset="UTF-8" src="{url:#js/jquery.iframe-post-form.js}"></script>
<div class="container clearfix">
	{widget:name=sub_navs action=ucsidebar sidebar=$sidebar act=$actionId}
	<div class="content clearfix uc-content">
		<h1 class="title"><span>申请开通：</span></h1>
		{if:isset($msg)}
		<div class="message_{$msg[0]} ie6png">{$msg[1]}</div>
		{elseif:isset($validator)}
		<div class="message_warning ie6png">{$validator['msg']}</div>
		{/if}
		<div class="mt10" style="position:relative;">
			<div class="tab">
				<ul class="tab-head">
					<!-- 
					<li>申请店铺<i></i></li>
					-->
					<li>申请代理<i></i></li>
				</ul>
			<div class="tab-body">
			
			
			<div class='p10'>
			<!-- 申请代理 -->
		
			{if:!empty($sq_obj)}
				<table class="simple">
						<tr><th width="120">上次申请时间</th><td>{$sq_obj['sq_time']}</td></tr>
						<!-- 
						<tr><th width="120">代理地区</th><td>{echo:Zyk_tj::zyk_info('area',$dlinfo['province'],'name')} - {echo:Zyk_tj::zyk_info('area',$dlinfo['city'],'name')} - {echo:Zyk_tj::zyk_info('area',$dlinfo['county'],'name')}</td></tr>
						-->
						<tr><th width="120">申请类型</th>
						<td>
						<span class="red">{echo:Common::getShenfenName($sq_obj['sq_lx'])}</span>
						</td></tr> 
						<tr><th width="120">审核时间</th><td>{$sq_obj['sh_time']}</td></tr>
						<tr><th width="120">状态</th><td>
							{if:$sq_obj['is_ok']==0}
								审核中
							{elseif:$sq_obj['is_ok']==1}
								已通过
							{elseif:$sq_obj['is_ok']==2}
								已拒绝
							{/if}
						</td></tr>
					</table>
			{/if}
			{if:$user['u_lx']<2}
			<form id="info-form1" class="simple" action="{url:/ucenter/agent_add}" method="post">
				<table class="form">
					<tr>
						<td class="label">当前身份：</td>
						<td>
							{if:$user['u_lx']==0}
								普通会员
							{elseif:$user['u_lx']==1}
								服务中心
							{elseif:$user['u_lx']==2}
								分公司
							{/if}
						</td>
					</tr>
					<tr>
						<td class="label">申请类型：</td>
						<td id="refund_type">
						
						<select id="lx" name="lx" >
					        <option value="1">服务中心</option>
					        <option value="2">分公司</option>
				        </select>
				        </td>
					</tr>
					
					<tr>
						<td colspan="2" class="tc"><input type="submit" class="btn" value="提交"></td>
					</tr>
				</table>
			</form>
			{/if}
		
			</div>
			</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
$("#sq_ck").on('click',function(){
	var id = $("input[name='id']:checked").val();
	$.post("{url:/ucenter/sq_ck}",{id:id},function(data){
		if(data['status']=='success'){
			alert('申请成功！');
			location.reload();
		}else{
			alert(data['msg']);
		}
	},'json');
});
	var form =  new Form('info-form');
	form.setValue('is_default','{$is_default}');
	$("#areas").Linkage({ url:"{url:/ajax/area_data}",selected:[{$province|0},{$city|0},{$county|0}],callback:function(data){
		var text = new Array();
		var value = new Array();
		for(i in data[0]){
			if(data[0][i]!=0){
				text.push(data[1][i]);
				value.push(data[0][i]);
			}
		}
		$("#test").val(value.join(','));
		FireEvent(document.getElementById("test"),"change");
	}});
	var form1 =  new Form('info-form1');
	form1.setValue('is_default','{$is_default}');
	$("#areas").Linkage({ url:"{url:/ajax/area_data}",selected:[{$province|0},{$city|0},{$county|0}],callback:function(data){
		var text = new Array();
		var value = new Array();
		for(i in data[0]){
			if(data[0][i]!=0){
				text.push(data[1][i]);
				value.push(data[0][i]);
			}
		}
		$("#test").val(value.join(','));
		FireEvent(document.getElementById("test"),"change");
	}});
	{if:isset($invalid)}
	autoValidate.showMsg({id:$("input[name='{$invalid['name']}']").get(0),error:true,msg:'{$invalid['msg']}'});
	{/if}
</script>
<script>
$(".select_button").on("click",function(){
      uploadFile();
      return false;
    });
function uploadFile(){
	// alert("ok");
  art.dialog.open('{url:/ucenter/photoshop?type=10}',{id:'upimg_dialog',title:'选择图片',width:613,height:380});
}
function setImg(value){
  $("#dp_logo").val(value);
  $("#img-show").html("<img height='100' src='{url:@}"+value+"'>");
  art.dialog({id:'upimg_dialog'}).close();
}
function check_invalid(e){
  if(e==null){
    return true;
  }
  else{
    var index = $('.tab-body > *').has(e).index();
    tabs_select(0,index);
    return false;
  }  
}
</script>